﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Exentials.Xoox.Styles
{
    public class XPatternFill : XFill
    {
        private XAttributeBase<PatternType> _patternType;
        private XElementBase patternFill;
        private XColor _fgColor;
        private XColor _bgColor;

        public XPatternFill(PatternType pattern)
            : base()
        {
            patternFill = new XElementBase("patternFill");
            this.GetXElement().Add(patternFill.GetXElement());
            _patternType = new XAttributeBase<PatternType>(patternFill, "patternType", pattern);            
        }

        public PatternType PatternType
        {
            get { return _patternType.Value; }
            set { _patternType.Value = value; }
        }

        public XColor ForeColor
        {
            get
            {
                if (this._fgColor == null) patternFill.Add(_fgColor = new XColor("fgColor"));
                return _fgColor;
            }
        }

        public XColor BackgroundColor
        {
            get 
            {

                if (this._bgColor == null) patternFill.Add(_bgColor = new XColor("bgColor"));
                return _bgColor; 
            }
        }
    }
}
